# -*- coding:utf-8 -*-
# @Time    :2020/1/8 0008 9:37
# @Author  :wulin
# @Mail    :286075568@qq.com
# @FileName: deletelog.py
# @Software: PyCharm

import time
import os
from common.outlog import MyLog

# 用于删除日志文件，目前保存7天
logger = MyLog('INFO')


def compare_time(stime, etime):
    s_time = time.mktime(time.strptime(stime, '%Y-%m-%d'))
    e_time = time.mktime(time.strptime(etime, '%Y-%m-%d'))
    if (int(e_time) - int(s_time)) > 691200:
        os.remove('./test_result/log_txt/ydh_api_' + stime + '.txt')
        logger.info('ydh_api_' + stime + '.txt' + '-日志超过7天已被系统删除！！！')
    else:
        pass
        logger.info('当前无可删除的日志！！！')

    # 调试
    # if __name__ == '__main__':
    #
    #     compare_time(data2, now)
    #             # print(result)
